package com.leyu.mall.site.product.controller;

import java.util.Collections;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.leyu.mall.common.facade.ICmsChannelFacade;
import com.leyu.mall.common.model.GoodsDetailModel;
import com.leyu.mall.service.goods.IGoodsDetailService;

@Controller
@RequestMapping
public class ProductDetailController {
	@Autowired
	private ICmsChannelFacade cmsChannelFacade;
	@Autowired
	IGoodsDetailService goodsDetailService;
	@ModelAttribute("list")
	public List createChannelList(){
		try {
			return cmsChannelFacade.getDisplayChannelList();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return Collections.EMPTY_LIST;
	}
/*	@RequestMapping(value = "/detail")
	public String detail(){
		
		return "product/mobile_detail.html";
	}*/
	@RequestMapping(value = "/detail/{productId}")
	public String detail(@PathVariable("productId") Long productId){
		GoodsDetailModel detail=goodsDetailService.findGoodsModel(productId);
		return "product/mobile_detail.html";
	}
}
